package be.vdab.dao;

import java.util.List;

import javax.persistence.TypedQuery;

import be.vdab.entities.Genre;

public class GenreDAO extends AbstractDAO {
	
	/*
	public Genre read(long genreNr) {
		return getEntityManager().find(Genre.class, genreNr);
	}
	
	public List<Genre> findAll() {
		TypedQuery<Genre> query = getEntityManager()
				.createQuery(
						"select g from Genre g",
						Genre.class);
		return query.getResultList();
	}*/
	
	public Genre read(long genreNr) {
		return getEntityManager().find(Genre.class, genreNr);
	}
	
	public List<Genre> findAll() {
		TypedQuery<Genre> query = getEntityManager().createNamedQuery("findAllGenres", Genre.class);
		return query.getResultList();
	}
}
